package hello;

import java.util.Collections;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.messaging.simp.SimpMessagingTemplate;
import org.springframework.stereotype.Service;

@Service
public class SubscribeUtil {
  @Resource
  private SimpMessagingTemplate messageTemplate;

  public void subScribe() {
   Map<String,String> reMap= Collections.singletonMap("content", "项目内自动推动的东西");
    messageTemplate.convertAndSend("/topic/greetings",reMap );
  }
}
